package safety.impl;

import agricultural.AgriculturalMachine;
import safety.SafetyEventType;
import safety.SafetyHandler;

public class ObstacleAvoidanceHandler extends SafetyHandler {
    @Override
    public void handleSafetyEvent(SafetyEventType eventType, AgriculturalMachine machine) {
        if (eventType == SafetyEventType.OBSTACLE_DETECTED) {
            System.out.println("障碍物避障处理器: " + machine.getMachineId() + "检测到障碍物，启动紧急避障");
            System.out.println(machine.getMachineId() + "执行紧急避障策略: 停止前进，后退1米，右转30度");
        } else if (nextHandler != null) {
            nextHandler.handleSafetyEvent(eventType, machine);
        }
    }
}    